#include "ax_hashtable.h"
#include <stdio.h>
#include "ax_printf.h"
#include "ax_list.h"
int main(int argc, char* argv[])
{
    ax_hashtable* table = ax_hashtable_create(HT_KEY_CONST | HT_VALUE_CONST);

    ax_hashtable_insert(table, "dog", 3, "1", 1);
    ax_hashtable_insert(table, "cat", 3, "2", 1);

    ax_debug("hashtable size:%d\n", ax_hashtable_size(table));

    char*  key;
    char*  value;
    size_t value_size;
    ax_hashtable_foreach(key, value, table)
    {
        ax_debug("key:%s value:%s\n", (char*)key, (char*)value);
    }

    ax_debug("containt dog? %d\n", ax_hashtable_contains(table, "dog", 3));
    ax_debug("containt cat? %d\n", ax_hashtable_contains(table, "cat", 3));
    ax_debug("containt bird? %d\n", ax_hashtable_contains(table, "bird", 4));

    ax_hashtable_remove(table, "dog", 3);
    ax_debug("containt dog? %d %d\n", ax_hashtable_contains(table, "dog", 3), ax_hashtable_size(table));

    value = (char*)ax_hashtable_get(table, "cat", 3, &value_size);
    ax_debug("cat : %s size:%d\n", value, value_size);

    ax_hashtable_foreach(key, value, table)
    {
        ax_debug("key:%s value:%s\n", (char*)key, (char*)value);
    }

    ax_hashtable_clear(table);
    ax_debug("size:%d\n", ax_hashtable_size(table));

    ax_hashtable_destory(table);
    return 0;
}
